package com.yykj.hospital.server.model.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yykj.common.util.serializer.LocalDate2LongSerializer;
import io.swagger.annotations.ApiModelProperty;
import jdk.net.SocketFlow;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.time.LocalDateTime;

@Data
@Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HospitalSettingAppointment {
    @Id
    @ApiModelProperty("医院ID")
    private Integer hospitalId;

    @ApiModelProperty("取消预约次数限制：单位次，默认3")
    private Integer cnt1 ;

    @ApiModelProperty("最晚取消预约时间：单位小时，默认24")
    private Integer cnt2;

    @ApiModelProperty("可预约最长时间:单位天，默认30")
    private Integer cnt3;

    @ApiModelProperty("最多可预约科室：默认2")
    private Integer cnt4;

    @ApiModelProperty("同一科室可预约号源：默认1")
    private Integer cnt5;

    @ApiModelProperty("一周内最多可约号源：默认7")
    private Integer cnt6;


    @ApiModelProperty("挂号需知")
    private String notice;

    @ApiModelProperty("启用停用状态")
    private Boolean status;

    @CreationTimestamp
    @ApiModelProperty("创建时间")
    @JsonSerialize(using = LocalDate2LongSerializer.class)
    private LocalDateTime addTime;

    @UpdateTimestamp
    @ApiModelProperty("修改时间")
    @JsonSerialize(using = LocalDate2LongSerializer.class)
    private LocalDateTime modifyTime;

    public static HospitalSettingAppointment defaultHospitalSettingAppointment(Integer hospitalId){
        return HospitalSettingAppointment.builder()
                .hospitalId(hospitalId)
                .cnt1(3)
                .cnt2(24)
                .cnt3(30)
                .cnt4(2)
                .cnt5(1)
                .cnt6(7)
                .notice("这是挂号提示")
                .status(true)
                .build();
    }

}
